package mylibrary.thread.FileDigest;

import java.util.ArrayList;
import java.util.List;

public class Test {

	private List result = new ArrayList();
	
	public static void main(String[] args) throws Exception {
		
//		String[] files = {"c:\\SmallChanges12_4_10_eShop_2013-01-24.fpr", "c:\\P11_Phase_2.xlsx",
//				"c:\\tomcat.keystore", "c:\\logs\\qiyexuexi.log"};
		String[] files = {"c:\\P11_Phase_2.xlsx",
				"c:\\tomcat.keystore", "c:\\logs\\qiyexuexi.log"};
		
	
		Test test = new Test();
		for(int i=0; i<files.length; i++) {
			FileDigestThread t = new FileDigestThread(files[i], test);
			Thread th = new Thread(t);
			th.start();
		}
		
		Thread.sleep(1000);
		test.showResult();
		
	}
	
	private void showResult() {
		System.out.println("Final result:");
		for(int i=0; i<result.size(); i++) {
			System.out.println(result.get(i));
		}
		System.out.println("==========");
	}
	
	public void receiveResult(String digest) {
		result.add(digest);
	}
}
